<!--
 * @FileDescription: 修片师注册
 * @Author: zsf
 * @Date: 2021-03-29 21:28:53
 * @LastEditors: zsf
 * @LastEditTime: 2021-03-29 22:02:11
-->
<template>
  <div class="retoucher-regis">
    <div class="center">
      <!-- 流程模块 -->
      <div class="right" v-if="!showRegist">
        <div class="title">修片师入驻流程</div>
        <div class="cont">
          <div class="item">
            <img src="../../assets/img/a_1.png" alt="" />
            <div class="text">填写注册资料。</div>
            <i class="iconfont icon-xuxian"></i>
          </div>
          <div class="item">
            <img src="../../assets/img/a_2.png" alt="" />
            <div class="text">平台工作人员进行资格审核。</div>
            <i class="iconfont icon-xuxian"></i>
          </div>
          <div class="item">
            <img src="../../assets/img/a_3.png" alt="" />
            <div class="text">审核通过，入驻成功。</div>
            <i class="iconfont icon-xuxian"></i>
          </div>
          <div class="item">
            <img src="../../assets/img/c_2.png" alt="" />
            <div class="text">接收影楼商家试片邀请。</div>
            <i class="iconfont icon-xuxian"></i>
          </div>
          <div class="item">
            <img src="../../assets/img/b_3.png" alt="" />
            <div class="text">试片满意，和影楼商家签订合作协议。</div>
            <i class="iconfont icon-xuxian"></i>
          </div>
          <div class="item">
            <img src="../../assets/img/a_5.png" alt="" />
            <div class="text">完成影楼商家发布的修片任务，获得订单佣金。</div>
          </div>
          <div class="item">
            <a-button class="my-ant-orange-btn" @click="showRegist = true">立即注册</a-button>
          </div>
        </div>
      </div>

      <!-- 注册模块 -->
      <div class="right" v-else>
        <div class="title">修片师账号注册</div>
        <div class="form">
          <a-form-model
            ref="ruleForm"
            :model="form"
            :rules="rules"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
          >
            <a-form-model-item label="手机号">
              <a-input v-model="form.phone" />
            </a-form-model-item>
            <a-form-model-item label="验证码">
              <a-row :gutter="8">
                <a-col :span="12">
                  <a-input v-model="form.code" />
                </a-col>
                <a-col :span="12">
                  <a-button class="my-ant-orange-btn">点击获取</a-button>
                </a-col>
              </a-row>
            </a-form-model-item>
            <a-form-model-item label="密码">
              <a-input v-model="form.password" />
            </a-form-model-item>
            <a-form-model-item label="确认密码">
              <a-input v-model="form.surePassword" />
            </a-form-model-item>
            <a-form-model-item label="姓名" prop="name">
              <a-input v-model="form.name" />
            </a-form-model-item>
            <a-form-model-item label="性别">
              <a-radio-group v-model="form.gender">
                <a-radio :value="1"> 男 </a-radio>
                <a-radio :value="2"> 女 </a-radio>
              </a-radio-group>
            </a-form-model-item>
            <a-form-model-item label="身份证号">
              <a-input v-model="form.identityNumber" />
            </a-form-model-item>
            <a-form-model-item label="身份证照">
              <a-row :gutter="8">
                <a-col :span="8" style="margin-right:10px">
                  <a-upload
                    name="avatar"
                    list-type="picture-card"
                    class="avatar-uploader"
                    :show-upload-list="false"
                    action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
                    :before-upload="beforeUpload"
                    @change="handleChange"
                  >
                    <img v-if="form.positiveImg" :src="form.positiveImg" alt="avatar" />
                    <div v-else>
                      <a-icon :type="positiveLoading ? 'loading' : 'plus'" />
                      <div class="ant-upload-text">上传正面</div>
                    </div>
                  </a-upload>
                </a-col>
                <a-col :span="8">
                  <a-upload
                    name="avatar"
                    list-type="picture-card"
                    class="avatar-uploader"
                    :show-upload-list="false"
                    action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
                    :before-upload="beforeUpload"
                    @change="handleChange"
                  >
                    <img v-if="form.backImg" :src="form.backImg" alt="avatar" />
                    <div v-else>
                      <a-icon :type="backLoading ? 'loading' : 'plus'" />
                      <div class="ant-upload-text">上传背面</div>
                    </div>
                  </a-upload>
                </a-col>
              </a-row>
              <a-row :gutter="8">
                <div class="warning">请确保身份证上信息清晰可辨，且照片小于5MB</div>
              </a-row>
            </a-form-model-item>
            <a-form-model-item label="身份地址">
              <a-input v-model="form.phone" />
            </a-form-model-item>
            <a-form-model-item label="门店名称">
              <a-input v-model="form.phone" />
            </a-form-model-item>
            <a-form-model-item label="注册地区">
              <a-cascader :options="areaOptions" @change="areaOnChange" />
            </a-form-model-item>
            <a-form-model-item label="邀请人手机号">
              <a-input v-model="form.inviterPhone" />
            </a-form-model-item>
            <a-form-model-item :wrapper-col="{ span: 10, offset: 6 }" class="sub-btn-cont">
              <a-button class="my-ant-gray-btn btn" @click="showRegist = false"> 取消 </a-button>
              <a-button
                class="my-ant-orange-btn btn"
                style="margin-left: 50px"
                type="primary"
                @click="onSubmit"
              >
                提交
              </a-button>
            </a-form-model-item>
          </a-form-model>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      labelCol: { span: 6 },
      wrapperCol: { span: 10 },
      showRegist: false,
      form: {
        phone: '',
        code: '',
        password: '',
        surePassword: '',
        name: '',
        gender: 1,
        identityNumber: '',
        positiveImg: '',
        backImg: '',
        identityAdress: '',
        inviterPhone: '',
      },
      positiveLoading: false,
      backLoading: false,
      areaOptions: [], // 地区数据
      rules: {
        name: [
          { required: true, message: 'Please input Activity name', trigger: 'blur' },
          { min: 3, max: 5, message: 'Length should be 3 to 5', trigger: 'blur' },
        ],
      },
    };
  },
  methods: {
    onSubmit() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          console.log('submit!!');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    resetForm() {
      this.$refs.ruleForm.resetFields();
    },
    beforeUpload(file) {

    },
    handleChange(info) {

    },
    areaOnChange(value) {
      this.form.identityAdress = value;
    }
  },
};
</script>

<style lang="less" scoped>
.retoucher-regis {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7bb95 0%, #f87f76 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  .center {
    width: 1523px;
    height: 849px;
    background: #ffffff;
    box-shadow: 0px 9px 23px rgba(248, 127, 118, 0.34);
    border-radius: 36px;
    display: flex;
    margin: 0 50px;
    align-items: center;
    justify-content: center;
    .right {
      flex: 0 0 800px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      .title {
        width: 198px;
        height: 22px;
        margin-left: 80px;
        font-size: 22px;
        font-family: Source Han Sans CN;
        font-weight: bold;
        line-height: 37px;
        color: #343434;
        position: relative;
        &::before {
          content: '';
          width: 5px;
          height: 25px;
          background: #F47458;
          position: absolute;
          left: -15px;
          top: 7px;
        }
      }
      .cont {
        display: flex;
        flex-direction: column;
        margin: 55px 0 0 150px;
        .item {
          display: flex;
          align-items: center;
          margin: 0 0 22px 0;
          position: relative;
          img {
            width: 84px;
            height: 84px;
          }
          .text {
            margin: 0 0 0 80px;
            font-size: 15px;
            color: #343434;
          }
          .my-ant-orange-btn {
            margin: 0 0 0 164px;
          }
          .icon-xuxian {
            position: absolute;
            left: 27px;
            bottom: -33px;
            font-size: 30px;
            transform: rotate(90deg);
          }
        }
      }

      .form {
        margin: 21px 0 0 0;
        .warning {
          font-size: 14px;
          color: #ff7c7c;
        }
        .sub-btn-cont {
          margin: 15px 0;
          /deep/ .ant-form-item-children {
            display: flex;
            justify-content: space-between;
          }
          .btn {
            width: 154px;
          }
        }
      }
    }
    .ant-form-item {
      margin-bottom: 0px;
    }
    /deep/.ant-radio-inner::after {
      background-color: #F47458;
    }
    /deep/.ant-radio-checked .ant-radio-inner {
      border-color: #F47458;
    }
  }
}
</style>